package io.github.bigbird0101.pipeline;

import java.util.List;
import java.util.Optional;

public interface Pipeline {
    List<String> getNames();
    Optional<Handler> get(String name);
    Optional<Handler> getFirst();
    Optional<Handler> getNext(Handler handler);
    Optional<Handler> getLast();
    Optional<HandlerContext> getContext(Handler handler);
    Optional<HandlerContext> getContext(String name);
    Optional<HandlerContext> getContext(Class<? extends Handler> handlerType);
    <T extends Handler> Optional<T> get(Class<T> handlerType);
    void addFirst(String name,Handler handler);
    void addLast(String name,Handler handler);
    void addBefore(String baseName,String name,Handler handler);
    void addAfter(String baseName,String name,Handler handler);
    Handler remove(String name);
    Handler removeFirst();
    Handler removeLast();
    <T extends Handler> T remove(Class<T> handlerType);
    void replace(Handler oldHandler,String newName,Handler newHandler);
    Handler replace(String oldName,String newName,Handler newHandler);
    <T extends Handler> T replace(Class<T> handlerType,String newName,Handler newHandler);
}
